import { updateName } from '../../../services/usercenter/index'
Page({
  data: {
    nameValue: '',
  },
  onLoad(options) {
    const { name } = options;
    this.setData({
      nameValue: name,
    });
  },
  onSubmit() {
    updateName({ 'userName': this.data.nameValue }).then(res => {
      console.log('update name result', res)
      if (res.code === 200) {
        wx.navigateBack({ backRefresh: true });
      }
    })
  },
  clearContent() {
    this.setData({
      nameValue: '',
    });
  },
});
